<template>
  <div id="app">
    <h1>This is an page1</h1>
    <h1>This is an page1</h1>
    <h1>{{testUnicode}}</h1>
    <img src="@/assets/logo.png">
    <base-btn :btnName="abc"></base-btn>
  </div>
</template>

<script>
import BaseBtn from '@/components/BaseBtn';
import qs from 'query-string';
import moment from 'moment';
import axios from 'axios';

import { isEmpty } from '@/utils/js/utils.js';

export default {
  data() {
    return {
      abc: '123',
      testUnicode: 'I \u2661 JavaScript!'
    };
  },
  methods: {
    http1() {
      return this.$http
        .post('/360ChannelView/getBasicInfo', {
          token: '307f6676115cd5e4c9d65e0f7927c784',
          CHANNEL_NO: '18b015d',
          channelNo: '18b015d'
        })
        .then(res => {
          console.log(res);
          return res;
        });
    },
    http2() {
      return this.$http
        .post('/360ChannelView/getBasicInfo', {
          token: '307f6676115cd5e4c9d65e0f7927c784',
          CHANNEL_NO: '18b015d',
          channelNo: '18b015d'
        })
        .then(res => {
          console.log(res);
          return res;
        });
    }
  },
  created() {
    let a = qs.parse(location.search);
    console.log(a);

    console.log(moment());

    console.log(isEmpty(a));

    console.log(isEmpty({}));

    a._data && console.log(JSON.parse(a._data));

    this.http1();

    axios.all([this.http1(), this.http2()]).then(
      axios.spread((res1, res2) => {
        console.log(res1);
        console.log(res2);
        console.log('ok');
      })
    );
  },
  components: {
    BaseBtn
  }
};
</script>
